<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title></title>
		<script type="text/javascript">
			window.onload = function(){
				var cars = ["奔驰","宝马","奥迪"];
				var ul = document.createElement("ul");
				for (var k in cars) {
					console.log(k);
					var li =document.createElement("li");
					var txt = document.createTextNode(cars[k]);
					li.appendChild(txt);
					ul.appendChild(li);
					
					li.addEventListener("mouseenter", function(){
							this.style.backgroundColor ="gray";
					});
					li.addEventListener("mouseleave", function(){
						    this.style.backgroundColor ="";
					});

				}
				console.log(li)
				document.body.appendChild(ul);

			}
		</script>
	</head>
	<body>
	</body>
</html>
